<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of BaseDatos
 *
 * @author INGENIERIA
 */
class BaseDatos {

    //put your code here
    private $servidor;
    private $usuario;
    private $contraseña;
    private $nombreBD;

    function BaseDatos() {
        $this->servidor = "localhost";
        $this->usuario = "root";
        $this->contraseña = "";
        $this->nombreBD = "adminBienes";
    }

    function conectar() {
        $link = mysql_connect($this->servidor,$this->usuario,$this->contraseña);
        mysql_select_db($this->nombreBD, $link);
    }

    function insertar($tabla = "", $fila = array()) {
        $valoresFila = "";
        while (list($key, $val) = each($fila)) {
            $valoresFila = $valoresFila . "'" . $val . "',";
        }
        $valoresFila = substr($valoresFila, 0, -1);
        $query = " insert into " . $tabla . " values(" . $valoresFila . ") ; ";
        mysql_query($query)or die("la consulta fallo" . mysql_error());
    }

}

//<form method="get">
//      <form method="pos" action="control.php">
?>